package cn.edu.sjtu.se.dslab.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.sjtu.se.dslab.component.data.EquipmentCategory;
import cn.edu.sjtu.se.dslab.component.data.EquipmentProperty;
import cn.edu.sjtu.se.dslab.dao.IEquipmentPropertyDao;
import cn.edu.sjtu.se.dslab.service.IEquipmentPropertyService;

@Service("equipmentPropertyService")
@Transactional
public class EquipmentPropertyServiceImpl implements IEquipmentPropertyService {

	@Resource(name="equipmentPropertyDao")
	private IEquipmentPropertyDao equipmentPropertyDao;
	
	@Override
	public boolean addEquipmentProperty(EquipmentProperty property) {
		// TODO Auto-generated method stub
		equipmentPropertyDao.save(property);
		return true;
	}

	@Override
	public boolean updateEquipmentProperty(EquipmentProperty property) {
		// TODO Auto-generated method stub
		equipmentPropertyDao.update(property);
		return true;
	}

	@Override
	public EquipmentProperty getEquipmentPropertById(long id) {
		// TODO Auto-generated method stub
		return equipmentPropertyDao.queryById(id);
	}

	@Override
	public List<EquipmentProperty> getEquipmentPropertyByEquipmentCategory(
			EquipmentCategory category) {
		// TODO Auto-generated method stub
		return equipmentPropertyDao.queryByEquipmentCategory(category);
	}

}
